UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EL+Wqqx25E7z3++8kpPrdV4/Dm1pW1pLdhdK1nofglo=' 
WHERE 
  key_id = '7778e39b9e070407955441078a20139c3a353beee32c65a6dde89d58feb7bd1f' 
  AND (
    token = 'EL+Wqqx25E7z3++8kpPrdV4/Dm1pW1pLdhdK1nofglo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035