UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HNsEbOqzNDvtpi51WV271y4UxtbV6lDxmALwMYzaONU=' 
WHERE 
  key_id = '6dbde138cf204b4ec3ef86d8062b8b57c6cfe6656c980cc688a9d7c621f831bb' 
  AND (
    token = 'HNsEbOqzNDvtpi51WV271y4UxtbV6lDxmALwMYzaONU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057