UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gtGKCN6cyzP5PWWzhAEVOsj5//QisJ2GZ6CLsp91JeY='
WHERE
key_id = 'b9724c63421d5b64059f9a1ecad7015c4b594e9faaaec1c3c751aaeb645cf7e6'
AND (
token = 'gtGKCN6cyzP5PWWzhAEVOsj5//QisJ2GZ6CLsp91JeY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)