UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6di1kuSN5rIYQT2wtVjZbWwhi/o9bz5Fobr9oFQW8MY='
WHERE
key_id = '887ac788d6ffa83d1c5a8c04580d7fa1aa2799addf0149d7ea2940667a9cd055'
AND (
token = '6di1kuSN5rIYQT2wtVjZbWwhi/o9bz5Fobr9oFQW8MY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)