UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'abm2KH1elji/eaLfNcgSt/jCuvMEPNTYpOBNndW3YfY=' 
WHERE 
  key_id = '74a025aa8786f368a1c9ff9a16789acc5aa6e8953333b1984a3c8daef3654f65' 
  AND (
    token = 'abm2KH1elji/eaLfNcgSt/jCuvMEPNTYpOBNndW3YfY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030