UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yCuT3cOYFDBbGmA4/AkI8frhmYahlhNxrTsajpbXXt4='
WHERE
key_id = '23aa291e4149e7f8040d417514ddd8c5e8ce4998055566d32f7a68197eee998e'
AND (
token = 'yCuT3cOYFDBbGmA4/AkI8frhmYahlhNxrTsajpbXXt4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)