UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IdG/yZij7rpU1eigQ2+TAindWkEb9qqr+zOTkRD7zkY='
WHERE
key_id = 'a09dd94faec4d15d13234d0cbf08effeae8d043d58d50c71752691a0714ff6d9'
AND (
token = 'IdG/yZij7rpU1eigQ2+TAindWkEb9qqr+zOTkRD7zkY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)