UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GGhe8Uy27tnwMYorYlrduiVwCkYnnnj1SLgO/e2k2UA='
WHERE
key_id = 'bc4d08106a284a2ab5e0866734241f10c8a8a19f926603f9b28df63c74e2646b'
AND (
token = 'GGhe8Uy27tnwMYorYlrduiVwCkYnnnj1SLgO/e2k2UA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)