UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y6dF3NODciFDglly8oBcK+1a8OSga1uzKsnMY/wcurc='
WHERE
key_id = 'c3cd84da1d5c9b319050a032b2fa651892bdbdffcab7427d4efd8a55d6e8809e'
AND (
token = 'y6dF3NODciFDglly8oBcK+1a8OSga1uzKsnMY/wcurc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)