UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+QCVVeXQzcu9D7UUAvTIyOr/qQ2uYeDV2y6v9lA23Yw='
WHERE
key_id = '22a65a40a122200fc39d9cb4fd3d497f991d1110eabc9502082e8aab01f7bc50'
AND (
token = '+QCVVeXQzcu9D7UUAvTIyOr/qQ2uYeDV2y6v9lA23Yw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)