UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tL91WS5L4xUamefPt2pFUhLOrwZ+uy8PTaTUS7525Sk=' 
WHERE 
  key_id = 'b66e318aa3e6e870b020eece405a77a49b53022d7dc5a5bdd80494d7eb99efee' 
  AND (
    token = 'tL91WS5L4xUamefPt2pFUhLOrwZ+uy8PTaTUS7525Sk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042