UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'l5lk8FJVC5CjRkyF08f5HImaBerOQf5kE/ZsO96ErMQ='
WHERE
key_id = 'fd8e48b2652e1b5442cb45131c10bdfc4f2af48c810f90b582265a2fb6afcae8'
AND (
token = 'l5lk8FJVC5CjRkyF08f5HImaBerOQf5kE/ZsO96ErMQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)