UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j7ayjcLM8uc05Keptp7m0NEEnUvFurvb3PQcJdSJRHc=' 
WHERE 
  key_id = '36596a2f46754972eea499da1cb879cd8240994d07216210f802fe987596ee20' 
  AND (
    token = 'j7ayjcLM8uc05Keptp7m0NEEnUvFurvb3PQcJdSJRHc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030