UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p19ZrBOSXfmO10c5WJsvECBoSmsbESeB+XHyd0ij6SQ=' 
WHERE 
  key_id = 'f5b589d663a146a0824901664b8a9bb7dd2308b92b43387a8dcd7fd495def8bd' 
  AND (
    token = 'p19ZrBOSXfmO10c5WJsvECBoSmsbESeB+XHyd0ij6SQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031