UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B97dJLPnRDwsz7IVPzAI30wt+X3ShJ5lxKtbHYdHjEU=' 
WHERE 
  key_id = '76ff20ef687d0caf44162b825aef26cf441ecc255592d5c80af010863fb0b876' 
  AND (
    token = 'B97dJLPnRDwsz7IVPzAI30wt+X3ShJ5lxKtbHYdHjEU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035