UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5b4P0rKMmrK4C1gA267rCCfGwgpIYkUBVYgiZL/CMMs='
WHERE
key_id = 'd8a00048daf6bf30166dc401e497529315c7c19e84d9de0bc5c06bd18037ad57'
AND (
token = '5b4P0rKMmrK4C1gA267rCCfGwgpIYkUBVYgiZL/CMMs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)