UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3FPoH8ZJ4nIFRJKSnHCIuRuyedh/EvD0hDtNsb3kEN8='
WHERE
key_id = 'c9f6388f8a6996447d933001fec0f955150548f1fd0efbbe84d900a12c8abcdf'
AND (
token = '3FPoH8ZJ4nIFRJKSnHCIuRuyedh/EvD0hDtNsb3kEN8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)