UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2+ScP5mCj+BRT55ADe8FgO6+awODftEq4+kTFg8c5ag=' 
WHERE 
  key_id = '677eb9c6f5b728ce07cf133fc3e0dd73af68bc7623f22357c746d02fb331adde' 
  AND (
    token = '2+ScP5mCj+BRT55ADe8FgO6+awODftEq4+kTFg8c5ag=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035