UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ICsMB6nTyOjtImU71FyDXpvAW1lD7LovQNBMmcixpJA='
WHERE
key_id = '51a2de987bb390fde8a7e78055a61ae8aac3d56764ca20c4004b1e443bf14f81'
AND (
token = 'ICsMB6nTyOjtImU71FyDXpvAW1lD7LovQNBMmcixpJA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)