UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mFfyxLQrLv3ydbsmeEMH6y31qzU+o0GT8+EtmAJOZyw='
WHERE
key_id = 'd7137d243b2faed294e05b5aa007c871d78597a6a49a42db3734bee0a34a2fa9'
AND (
token = 'mFfyxLQrLv3ydbsmeEMH6y31qzU+o0GT8+EtmAJOZyw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)