UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'knT46/KBf4qbr+k2A5fue4s5fYrlqA+dI0dskSseRyM=' 
WHERE 
  key_id = 'abdf9c1ffd12bec03b52c8dd5070a7f45b5b75b0492a478632a8671daae331bb' 
  AND (
    token = 'knT46/KBf4qbr+k2A5fue4s5fYrlqA+dI0dskSseRyM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037