UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p8UoMlYjscdNQKT0xygWcgyQzVAI6q9H1Gai6zuObcc=' 
WHERE 
  key_id = '6297a1030bf3753bb76369e1ee0da16c87188334adf589c40570286c5c499064' 
  AND (
    token = 'p8UoMlYjscdNQKT0xygWcgyQzVAI6q9H1Gai6zuObcc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039