UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fbY6S7ZzUg6kh6HcwXi9eSX7+fj4N17UyPxTEPnCWSg=' 
WHERE 
  key_id = 'cb9b8a301d85b40e8ae8285430d973771ee426fb067699cc4d0e51d934f75a0b' 
  AND (
    token = 'fbY6S7ZzUg6kh6HcwXi9eSX7+fj4N17UyPxTEPnCWSg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038