UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aOPY0nxb+tua41Sb/BllV9/yYkKhb10fx00fxr4mF+g='
WHERE
key_id = '7c5374f064b05827b8d5474cfa8e89d8565b86d620cc49a35096fb9e0a2968ad'
AND (
token = 'aOPY0nxb+tua41Sb/BllV9/yYkKhb10fx00fxr4mF+g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)