UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sxQSSx74g1xFW9NXnonAScXXPmioFaSDqUixAlawxe4=' 
WHERE 
  key_id = '6e7406ebe8c5987cf18145e048b8b9d3b706d02c95e05958b408708045b6b535' 
  AND (
    token = 'sxQSSx74g1xFW9NXnonAScXXPmioFaSDqUixAlawxe4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018