UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zgBdbPHOWHJr7bQd8fMCkMv0VKDg16dQO8FMx3hEw2o='
WHERE
key_id = 'd56dec999eab1a7220895d6c952bcd866d3c1084d3a3327f4950b9f35ebae1a6'
AND (
token = 'zgBdbPHOWHJr7bQd8fMCkMv0VKDg16dQO8FMx3hEw2o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)