UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Gkz1PFRUiG5mj4rS6CA9pIprgSwiPydt3Y9J537FKYo='
WHERE
key_id = '9b3ecad9354958e48257b5137d86050c8be714cd010786c022d5c1fc704c5f32'
AND (
token = 'Gkz1PFRUiG5mj4rS6CA9pIprgSwiPydt3Y9J537FKYo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)