UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LjgpJbaWhLj+aEAh8HfbW0F/VHt1f5ud87xwvQvXMsE=' 
WHERE 
  key_id = '3f4000618e9d9d00f5b803661467f33098371ac38d6b9fdd55e5e087fee32268' 
  AND (
    token = 'LjgpJbaWhLj+aEAh8HfbW0F/VHt1f5ud87xwvQvXMsE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033