UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OhRhFgX9dDmVkKm9PNPlsIhT6MB7Iotk8pv8AOqe7uI='
WHERE
key_id = '8cd4cae729f486240c71aaae0f6fad0e0defde01771d8dec84d63ac42df7f8f2'
AND (
token = 'OhRhFgX9dDmVkKm9PNPlsIhT6MB7Iotk8pv8AOqe7uI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)