UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n9ifIoyg3CCV2ViX8BBy1O2Ir6w0aFuJflMvDZ3Q5cI=' 
WHERE 
  key_id = 'f7cab3763a9c419875b57f44a1fc17f39863ad48ce52ae830cbc412abfa8f179' 
  AND (
    token = 'n9ifIoyg3CCV2ViX8BBy1O2Ir6w0aFuJflMvDZ3Q5cI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039