UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TD8IIBRYbRVY+f6oSUIMULUwepl/8LP0dP71z2eZImc='
WHERE
key_id = '3e857d4d5c59f4b23878cff58a79a03b8d78154a6397c4b83c5996db2f2c8870'
AND (
token = 'TD8IIBRYbRVY+f6oSUIMULUwepl/8LP0dP71z2eZImc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)